package org.dce.screencapturer.actions.objects;

import java.awt.event.ActionEvent;

import org.dce.screencapturer.Drawing;
import org.dce.screencapturer.objects.DrawingObject;
import org.dce.screencapturer.util.IconFactory;

@SuppressWarnings("serial")
public class BringToBottomAction extends ObjectAction {

	public BringToBottomAction() {
		super("categories.object", "actions.bringToBack", IconFactory.getIcon("/images/bring-to-bottom.png"));
	}

	@Override
	protected boolean acceptObject(DrawingObject anObject) {
		return true;
	}

	@Override
	public void actionPerformed(ActionEvent event) {

		DrawingObject object = getObject();
		Drawing drawing = getDrawing();
		drawing.remove(object);
		drawing.add(object);
		drawing.repaint();

	}

}
